package cn.demo.act.domain;

import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.core.constant.SqlOperator;
import com.mybatisflex.core.query.SqlOperators;
import cn.demo.common.mybatisFlex.MyInsertListener;
import cn.demo.common.mybatisFlex.MyUpdateListener;
import cn.demo.common.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonIgnore;
import cn.demo.common.core.domain.BaseEntity;
/**
 * 活动报名管理对象 act_register
 *
 * @author xtjun
 * @date 2024-06-03
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table(value = "act_register",onInsert = MyInsertListener.class,onUpdate = MyUpdateListener.class)
public class ActRegister extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @Id
    @Schema(description = "id")
    private String id;

    @Excel(name = "活动id")
    @Schema(description = "活动id")
    private String activityId;

    @Excel(name = "用户id")
    @Schema(description = "用户id")
    private String userId;

    @Excel(name = "联系电话")
    @Schema(description = "联系电话")
    @NotBlank(message = "联系电话不能为空")
    private String contactNumber;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "申请时间")
    private LocalDateTime applyTime;

    // 自定义字段的 SQL 操作符
    @JsonIgnore
    public static final SqlOperators operators = new SqlOperators() {{
        set(ActRegister::getActivityId, SqlOperator.EQUALS);
        set(ActRegister::getUserId, SqlOperator.EQUALS);
        set(ActRegister::getContactNumber, SqlOperator.EQUALS);
    }};
}
